Ext.onReady(function() {

	var conn = new Ext.data.Connection();

    function onComboClick(item){
		conn.request({
			url: 'getfile.cgi?'+Ext.urlEncode({action: combo.value}),
			success: function(responseObject) {
				texta.setValue(responseObject.responseText);
			}
		});
	}


	var texta = new Ext.form.TextArea ({
		hideLabel: true,
		name: 'msg',
		style: 'font-family:monospace',
		anchor: '100% -53'
	});

	var combo = new Ext.form.ComboBox ({
		store: [==:names:==],
		name: 'file',
		shadow: true,
		editable: false,
		mode: 'local',
		triggerAction: 'all',
		emptyText: ttchooseconfigfile,
		width:200,
		selectOnFocus: true
	});


    var backup = new Ext.Button({
        cls: 'x-btn-text',
        text: ttbackbutton,
        handler: function (){
            location.href='./';
        }
    });
    
    var form = new Ext.form.FormPanel({
        baseCls: 'x-plain',
        url:'save-form.php',
        items: [
			new Ext.Toolbar({
				items: [
					'-',
					backup,
					'-',
					combo,
					'-'
				]
			}),
			texta
		]
    });

	combo.addListener('select',onComboClick);

    var window = new Ext.Window ({
        title: viewbutton,
        width: 800,
        height:500,
        minWidth: 300,
        minHeight: 200,
		x:100, y:60,
        layout: 'fit',
        plain:true,
        bodyStyle:'padding:5px;',
		items: form
    });

    window.show();
});
